package package6;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class Test2 {
	public void readFromString(String a) throws IOException{
		if(a==null)
			return;
		byte[] bytes=a.getBytes();
		InputStream bin=new ByteArrayInputStream(bytes);
		ByteArrayOutputStream bout=new ByteArrayOutputStream();
		ByteArrayOutputStream bout2=new ByteArrayOutputStream();
		int inputData;
		while((inputData=bin.read())!=-1){
			bout.write(inputData);
		}
		bout.flush();
		System.out.println(bout);
		System.out.println(bout2);
		bout.flush();
		bout.close();
		bin.close();
		}
	public static void main(String args[]) throws IOException{
		Test2 test=new Test2();
		test.readFromString("hushizhu");
		
	}

}
